<?php include('src/listContractCompany_cs.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href='css/coolMessage.css' type='text/css' rel='stylesheet' media='screen' />
<link rel="stylesheet" type="text/css" href="mopTip/mopTip-2.2.css">
<title>Lista Contratos Compania :: ASSC</title>
<script language="javaScript" type="text/javascript" src="js/jquery.js"></script>

<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
<script type="text/javascript" src="mopTip/mopTip-2.2.js"></script>
<script type="text/javascript" src="js/jquery.pngFix-1.2.js"></script>

<script language="javaScript" type="text/javascript" src="js/jquery.simplemodal.js"></script>
<script language="javaScript" type="text/javascript" src="js/coolMessage.js"></script>

<script language="javascript" type="text/javascript">
	
	function showMessage(show_msg){
		switch(show_msg){
			case 1://error
				coolMessage('error',"<?php echo $_SESSION["msg_cool"];?>", function (){ window.location.href = '/listContractCompany.php'});
			break;
			
			case 2://alert
				coolMessage('alert',"<?php echo $_SESSION["msg_cool"];?>", function (){ window.location.href = '/listContractCompany.php'});
			break;
			
			case 3://information
				coolMessage('information',"<?php echo $_SESSION["msg_cool"];?>", function (){ window.location.href = '/listContractCompany.php'});
			break;
			
			default:
				
			break;
		}
		return false;
	}
	
	function contractCompanyDelete(coco_code,id){
		coolMessage("confirm",'Esta seguro que quiere eliminar este contrato con esta compania?',
		function (){
			jQuery.ajax({
				type: "POST",
				url: "deleteContractCompany.php",
				data: 'coco_code='+coco_code,
				success: function(msg){
					if(msg==1)
						$("#tr"+id).remove();
					else
						coolMessage("error", 'El contrato con esta compania no puede ser eliminado.');
				}
			});
		})
	}	

</script>
</head>
<body onload="javascript: showMessage(<?php echo $show_msg;?>)">
<?php $item_select = 13;include("menu.php");?><br />
<form name="form1" id="form1" method="post" action="">

    <div class="content_grv">
		<table class="tbl_list">
        	<tr>
            	<td colspan="6"><span class="title">LISTA DE CONTRATOS COMPANIAS CON ASSC Servicios y Soluciones de Colombia</span></td>
            </tr>
        	<tr>
            	<td colspan="7">
                	<table class="tbl_search">
                        <tr>
                        	<td><a href="reportClientPdf.php?use_code=<?php echo $_SESSION['use_code']; ?>" title="Reports" target="_blank">
                                <img src="images/report.png" width="45" height="45" />
                            	</a>
                            </td>
                            <td><input type="button" value="Adicionar Contrato Compania" class="button_grv" onclick="javascript: window.location.href='addContractCompany.php'"/></td>
                            <td align="right"><input type="text" name="search" size="40" value="<?php echo $search;?>" class="text_grv" /><input type="submit" name="Submit" value="Search" class="button_grv"/></td>
                        </tr>
                    </table>
                </td>
            </tr>  
            <?php if ( $totalFiles > 0){?>    
            <tr>
            	<?php for ( $i = 0; $i < count ($ord_href); $i++ ){?>
            	<td class="item_head" width="<?php echo $item_width[$i];?>"><?php echo $ord_href[$i];?></td>
                <?php }?>
            </tr>
            <?php 
				$i=0;
				while($i<count($contract_company)){
					
					if($i%2==0)
						$class='item_a';
					else
						$class='item_b';
			?>
			<tr id="tr<?php echo $i;?>">
                <td class="<?php echo $class;?>"><?php echo $contract_company[$i]->hdvc_name;?></td>
            	<td class="<?php echo $class;?>"><?php echo cambiarFormatoFecha($contract_company[$i]->coco_date_in,1);?></td>
                <td class="<?php echo $class;?>"><?php echo $contract_company[$i]->coco_pay;?></td>
                <td class="<?php echo $class;?>">$ <?php echo number_format($contract_company[$i]->coco_pay_value,2);?></td>
                <td class="<?php echo $class;?>"><?php echo $contract_company[$i]->coco_rep;?></td>
                <td class="<?php echo $class;?>"><?php echo $contract_company[$i]->coco_rep_tel1;?></td>
                <td class="<?php echo $class;?>">                    
                <!--    <a href="addBusiness.php?cli_code=<?php echo $company[$i]->hdvc_code;?>" title="Add Case">
                    	<img src="images/business.png" width="16" height="16"  />
                    </a> -->
                    <a href="updateContractCompany.php?coco_code=<?php echo $contract_company[$i]->coco_code;?>" title="Editar Contrato Compania">
                    	<img src="images/editar.png" width="16" height="16"  />
                    </a>
                    
                    <a href="javascript:;" onclick="javascript: return contractCompanyDelete(<?php echo $contract_company[$i]->coco_code;?>,<?php echo $i;?>);">
                    <img src="images/delete.png" width="16" height="16"  />
                    </a>
                </td>
            </tr>            
            <?php $i++; }?>
            
            <?php if ( $totalFiles > $cantidad){ ?>
            <tr>
            	<td colspan="7" align="center">
                	<table width="100%">
                    	<tr>
                        	<td align="center" width="25%"><a <?php if ($inicio == 0){ ?> class="lbl_gray" <?php } else {?> href="<?php echo $anterior; ?>"<?php } ?>>&lt;&lt;prev</a></td>
                            <td align="center" width="50%"><?php echo $paginas; ?></td>
                            <td align="center"><a <?php if ($totalPaginas == $paginaActual){ ?> class="lbl_gray" <?php } else {?> href="<?php echo $siguiente; ?>"<?php } ?>>next&gt;&gt;</a></td>
                        </tr>
                    </table>
                </td>
            </tr>            
            <?php } ?>
            
            <tr>
            	<td colspan="7" class="item_c" id="band_list"><?php echo $band_list;?></td>
            </tr>
            <?php }else{?>
            <tr>
            	<td colspan="7" class="no_data">No Data.</td>
            </tr>
            <?php }?>
        </table>
    </div>
</form>    
</body>
</html>
<?php include('divscoolmessage.php');?>